package io.yuncheng.common.config;

import org.codehaus.xfire.XFire;
import org.codehaus.xfire.annotations.WebAnnotations;
import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;
import org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.Ordered;

/**
 * 把该类作文spring.xml文件
 */
@ImportResource(locations = {"Xfire.xml"})
@Configuration
public class WebServiceConfig {
    @Bean
    public WebAnnotations webAnnotations(){
        return new Jsr181WebAnnotations();
    }
    @Bean
    public Jsr181HandlerMapping jsr181HandlerMapping(@Autowired XFire xFire) {
        Jsr181HandlerMapping jsr181HandlerMapping = new Jsr181HandlerMapping();
        jsr181HandlerMapping.setXfire(xFire);
        jsr181HandlerMapping.setWebAnnotations(webAnnotations());
        jsr181HandlerMapping.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return jsr181HandlerMapping;
    }
}
